import { Module, VuexModule, Mutation, getModule } from
    'vuex-module-decorators'

import store from '../index'
//暴露接口
export interface ILeftNavMenuStore {
    CurrentId: number
    CurrentChildId?: string
}
//设置模块的基本配置
@Module({
    name: 'LeftNavMenu',
    //表示为动态模块
    dynamic: true,
    store
})

// 创建并暴露LeftNavMenu类
export default class LeftNavMenu extends VuexModule implements ILeftNavMenuStore {
    // 模块的具体属性值
    public CurrentId = 0;
    public CurrentChildId = ""
    @Mutation
    public ChangeCurrentId(id: number): void {
        this.CurrentChildId=""
        this.CurrentId = id;
    }
    @Mutation
    public ChangeCurrentChildId(childId:string):void{
        this.CurrentChildId=childId
    }
}
// getModule可以创建一个类的实例
//创建并暴露LeftNavMenuStore用于后续使用
export const LeftNavMenuStore = getModule(LeftNavMenu)